﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RepositoryFramework.Extensions
{
	/// <summary>
	/// Class <see cref="TypeExtensions"/> define extensions to any object
	/// </summary>
	public static class TypeExtensions
	{

		/// <summary>
		/// Convert array objetc to the SQL parameter value.
		/// </summary>
		/// <param name="obj">The object.</param>
		/// <returns></returns>
		public static string ToSqlValue(this object obj)
		{
			if (obj != null)
			{
				if (obj is bool)
				{
					return (bool)obj ? "true" : "false";
				}
				else
				{
					return obj.ToString();
				}
			}
			return string.Empty;
		}
	}
}
